from fastapi import HTTPException
from starlette import status


# credential exception definition
def form_unauthorized_exception(msg: str):
    return HTTPException(
        status_code=status.HTTP_401_UNAUTHORIZED,
        detail=msg,
        headers={"WWW-Authenticate": "Bearer"},
    )


pb_authentication_exception = HTTPException(
    status_code=status.HTTP_401_UNAUTHORIZED,
    detail="Metastore authentication failed. Could not validate credentials",
    headers={"WWW-Authenticate": "Bearer"},
)
pb_operation_exception = HTTPException(
    status_code=status.HTTP_400_BAD_REQUEST,
    detail="Failed to modify."
)
